fix pi gpio to catch close timing error

This commit is contained in:
Dave Conway-Jones 2023-03-15 10:21:31 +00:00
parent 553ae44ccb
commit bd15c5d6dd
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
6 changed files with 26 additions and 15 deletions

View File

@ -83,9 +83,15 @@ module.exports = function(RED) {
});
node.child.on('error', function (err) {
if (err.errno === "ENOENT") { node.error(RED._("rpi-gpio.errors.commandnotfound")); }
else if (err.errno === "EACCES") { node.error(RED._("rpi-gpio.errors.commandnotexecutable")); }
else { node.error(RED._("rpi-gpio.errors.error",{error:err.errno})) }
if (err.code === "ENOENT") { node.error(RED._("rpi-gpio.errors.commandnotfound")+err.path,err); }
else if (err.code === "EACCES") { node.error(RED._("rpi-gpio.errors.commandnotexecutable")+err.path,err); }
else { node.error(RED._("rpi-gpio.errors.error",{error:err.code}),err) }
});
node.child.stdin.on('error', function (err) {
if (!node.finished) {
node.error(RED._("rpi-gpio.errors.error",{error:err.code}),err);
}
});
}
@ -198,11 +204,16 @@ module.exports = function(RED) {
});
node.child.on('error', function (err) {
if (err.errno === "ENOENT") { node.error(RED._("rpi-gpio.errors.commandnotfound")); }
else if (err.errno === "EACCES") { node.error(RED._("rpi-gpio.errors.commandnotexecutable")); }
else { node.error(RED._("rpi-gpio.errors.error")+': ' + err.errno); }
if (err.code === "ENOENT") { node.error(RED._("rpi-gpio.errors.commandnotfound")+err.path,err); }
else if (err.code === "EACCES") { node.error(RED._("rpi-gpio.errors.commandnotexecutable")+err.path,err); }
else { node.error(RED._("rpi-gpio.errors.error",{error:err.code}),err) }
});
node.child.stdin.on('error', function (err) {
if (!node.finished) {
node.error(RED._("rpi-gpio.errors.error",{error:err.code}),err);
}
});
}
else {
node.warn(RED._("rpi-gpio.errors.invalidpin")+": "+node.pin);

View File

@ -66,8 +66,8 @@
"invalidinput": "Ungültige Eingabe",
"needtobeexecutable": "__command__ muss ausführbar sein",
"mustbeexecutable": "nrgpio muss ausführbar sein",
"commandnotfound": "nrgpio-Befehl nicht gefunden",
"commandnotexecutable": "nrgpio-Befehl nicht ausführbar",
"commandnotfound": "nrgpio-Befehl nicht gefunden ",
"commandnotexecutable": "nrgpio-Befehl nicht ausführbar ",
"error": "Fehler: __error__",
"pythoncommandnotfound": "nrgpio-Python-Befehl nicht aktiv"
}

View File

@ -66,8 +66,8 @@
"invalidinput": "Invalid input",
"needtobeexecutable": "__command__ needs to be executable",
"mustbeexecutable": "nrgpio must to be executable",
"commandnotfound": "nrgpio command not found",
"commandnotexecutable": "nrgpio command not executable",
"commandnotfound": "nrgpio command not found ",
"commandnotexecutable": "nrgpio command not executable ",
"error": "error: __error__",
"pythoncommandnotfound": "nrgpio python command not running"
}

View File

@ -66,8 +66,8 @@
"invalidinput": "入力が不正です",
"needtobeexecutable": "__command__ は実行可能である必要があります",
"mustbeexecutable": "nrgpio は実行可能である必要があります",
"commandnotfound": "nrgpio コマンドが見つかりません",
"commandnotexecutable": "nrgpio コマンドが実行可能ではありません",
"commandnotfound": "nrgpio コマンドが見つかりません ",
"commandnotexecutable": "nrgpio コマンドが実行可能ではありません ",
"error": "エラー: __error__",
"pythoncommandnotfound": "nrgpio python コマンドが実行されていません"
}

View File

@ -65,8 +65,8 @@
"invalidinput": "입력이 올바르지 않습니다",
"needtobeexecutable": "__command__ 은 실행가능상태일 필요가 있습니다 ",
"mustbeexecutable": "nrgpio 은 실행가능상태일 필요가 있습니다 ",
"commandnotfound": "nrgpio 커맨드를 찾을수 없습니다",
"commandnotexecutable": "nrgpio 커맨드가 실행가능상태가 아닙니다",
"commandnotfound": "nrgpio 커맨드를 찾을수 없습니다 ",
"commandnotexecutable": "nrgpio 커맨드가 실행가능상태가 아닙니다 ",
"error": "에러: __error__",
"pythoncommandnotfound": "nrgpio python 커맨드가 실행되지 않았습니다"
}

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-pi-gpio",
"version": "2.0.5",
"version": "2.0.6",
"description": "The basic Node-RED node for Pi GPIO",
"dependencies" : {
},