Closed danivalls closed 4 years ago
Since you are running in Window, it means the user account you are using is not allowed to use the system ping.
You can check out the permission of your user account by using ping in the terminal.
If there are no errors on running ping in terminal, properly, you need some permission setting when developing with electron. That's allowing electron to use the system ping.
在 2019年11月3日週日 09:08,Daniel Valls notifications@github.com 寫道:
Hey there!
First of all thanks a lot for all the hard work on this node package.
I'm trying to create an electron app (currently running on Windows 10) that uses this package, but when I try to make the ping.promise.probe I get the following error:
Error: ping.probe: there was an error while executing the ping program. . Check the path or permissions... at ChildProcess.eval (ping-promise.js?96c3:54) at Object.onceWrapper (events.js:282) at ChildProcess.emit (events.js:194) at Process.ChildProcess._handle.onexit (internal/child_process.js:252) at onErrorNT (internal/child_process.js:429) at processTicksAndRejections (internal/process/task_queues.js:81)
This is the implementation I did of the package just to give it a try before doing anything more complex:
function pingHost(host) { return ping.promise.probe(host).then(function (pingResponse) { console.log('alive: ' + pingResponse.alive); console.log('time (ms): ' + pingResponse.time); }).catch(error => console.error(error)) }
I'm not sure if this is a bug or I'm just not using it properly. I'm not quite sure about what does it mean to "Check the path or permissions". Any help would be appreciated!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/danielzzz/node-ping/issues/105?email_source=notifications&email_token=AA5YBI4ZBXZSAYNINLPALN3QRYQBHA5CNFSM4JIJHEN2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HWNHE7Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5YBI5BZW5X325GXSTTWP3QRYQBHANCNFSM4JIJHENQ .
Thanks a lot for your help!
I can run ping on the terminal with no errors, and I have also tried doing a command ping from nodejs and it worked perfectly.
function systemPing (host) {
try {
var exec = require('child_process').exec;
const makePingCall = (error, stdout, stderr) => console.log(error, stdout, stderr)
exec(`ping ${host} -n 1`, makePingCall);
} catch (error) {
console.error(error)
}
}
Try to run your electron with system admin permission. If there are no errors, you need to figure out how to grant your electron for having proper permission.
If it is still unable to run the ping, you properly need to figure out where is your system ping in the view point of your electron application.
Maybe, just maybe, you may need to inject the system path for your app such that it knows how to locate the system ping
在 2019年11月3日週日 18:43,Daniel Valls notifications@github.com 寫道:
Thanks a lot for your help!
I can run ping on the terminal with no errors, and I have also tried doing a command ping from nodejs and it worked perfectly.
function systemPing (host) { try { var exec = require('child_process').exec; const makePingCall = (error, stdout, stderr) => console.log(error, stdout, stderr)
exec(`ping ${host} -n 1`, makePingCall);
} catch (error) { console.error(error) } }
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/danielzzz/node-ping/issues/105?email_source=notifications&email_token=AA5YBI7XEOAXQBEPQJVIQQ3QR2TN7A5CNFSM4JIJHEN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC5PPVA#issuecomment-549124052, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5YBI5R2HQ26YV3R25U4E3QR2TN7ANCNFSM4JIJHENQ .
Reopen if there are still issues regarding to this.
@danivalls Like me, is the problem solved?
Hey there!
First of all thanks a lot for all the hard work on this node package.
I'm trying to create an electron app (currently running on Windows 10) that uses this package, but when I try to make the ping.promise.probe I get the following error:
This is the implementation I did of the package just to give it a try before doing anything more complex:
I'm not sure if this is a bug or I'm just not using it properly. I'm not quite sure about what does it mean to "Check the path or permissions". Any help would be appreciated!