-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Labels
Description
I'm trying to check if my remote machine has a specific command by using which and checking its return code.
const hasWPCLI = transport.exec('which wp', { failsafe: true });
if(hasWPCLI.code !== 0) {
...
}However, I'm getting some strange results as sometimes it is returned '1' and sometimes '0'.
Returning 0:
✈ Running setup:staging
✈ Connecting to 'x.x.x.x'
✈ Executing remote task on x.x.x.x
x.x.x.x $ which wp
x.x.x.x > which: no wp in (/usr/local/bin:/bin:/usr/bin:/usr/local/bin)
x.x.x.x ● ok
Returning 1:
✈ Running setup:staging
✈ Connecting to 'x.x.x.x'
✈ Executing remote task on x.x.x.x
x.x.x.x $ which wp
x.x.x.x > which: no wp in (/usr/local/bin:/bin:/usr/bin:/usr/local/bin)
x.x.x.x ● failed safely (1)
Both calls were made seconds apart from each other.
Any thoughts on what's happening? Thanks!