Description
When running appcd exec /system-info/1.x/info/ it seemed to be taking longer than usual to return, checking the logs I saw the below, I think it's possible that two detect processes are attempting to build wptool at the same time. We apparently deal with this inside windowslib but it seems to be flaky, it might be wise to stagger the detects to allow one to build before the other runs
I've had trouble reproducing this in an appc cli build fwiw
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error Caught exception: Error: EBUSY: resource busy or locked, open 'C:\Users\ewan\Documents\git\appc-daemon\node_modules\windowslib\bin\wptool.exe'
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error     at Object.fs.openSync (fs.js:646:18)
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error     at Object.fs.writeFileSync (fs.js:1291:33)
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error     at Object.callback (C:\Users\ewan\Documents\git\appc-daemon\node_modules\windowslib\lib\wptool.js:596:7)
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error     at C:\Users\ewan\Documents\git\appc-daemon\node_modules\windowslib\lib\visualstudio.js:423:9
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error     at Array.forEach (<anonymous>)
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error     at ChildProcess.<anonymous> (C:\Users\ewan\Documents\git\appc-daemon\node_modules\windowslib\lib\visualstudio.js:415:11)
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error     at emitTwo (events.js:126:13)
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error     at ChildProcess.emit (events.js:214:7)
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error     at maybeClose (internal/child_process.js:925:16)
2017-11-20T16:24:57.446Z appcd:plugin:host:21052 error     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
Steps to reproduce
Remove wptool.exe from windowslib/bin folder
Start the daemon [appc] appcd start
Query system info [appc] appcd exec /system-info/1.x/info/
Actual
Plugin hangs, windows error above shown in logs
Expected
No hang
 
FYI, I ran into a similar problem on Linux with invoking a freshly download Node.js executable where I was getting an
EBUSYerror. I worked around it by implementing a try again loop: https://github.com/appcelerator/appc-daemon/blob/master/packages/appcd-nodejs/src/nodejs.js#L440.