pear-electron 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/runtime.js +11 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-electron",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Pear User-Interface Library for Electron",
5
5
  "main": "index.js",
6
6
  "bin": "bin.js",
package/runtime.js CHANGED
@@ -122,30 +122,30 @@ class PearElectron {
122
122
  })
123
123
 
124
124
  argv = ['boot.bundle', '--rti', info, ...argv]
125
- const stdio = args.detach ? ['ignore', 'ignore', 'ignore', 'overlapped'] : ['ignore', 'inherit', 'pipe', 'overlapped']
125
+ const stdio = args.detach
126
+ ? ['ignore', 'ignore', 'ignore', isWindows ? 'overlapped' : 'pipe']
127
+ : ['ignore', 'inherit', 'pipe', isWindows ? 'overlapped' : 'pipe']
126
128
  const options = {
127
129
  stdio,
128
130
  cwd,
129
131
  windowsHide: true,
130
132
  ...{ env: { ...env, NODE_PRESERVE_SYMLINKS: 1 } }
131
133
  }
132
-
133
- const sp = spawn(this.bin, argv, options)
134
+ let sp = null
134
135
  if (args.appling) {
135
136
  const { appling } = args
136
137
  const applingApp = isMac ? appling.split('.app')[0] + '.app' : appling
137
- try {
138
- fs.statSync(applingApp)
139
- } catch {
140
- throw ERR_INVALID_APPLING('Appling does not exist')
141
- }
142
- if (isMac) spawn('open', [applingApp, '--args', ...argv], options).unref()
143
- else spawn(applingApp, argv, options).unref()
138
+ if (fs.existsSync(applingApp) === false) throw ERR_INVALID_APPLING('Appling does not exist')
139
+ if (isMac) sp = spawn('open', [applingApp, '--args', ...argv], options)
140
+ else sp = spawn(applingApp, argv, options)
141
+ } else {
142
+ sp = spawn(this.bin, argv, options)
144
143
  }
145
144
 
146
- // TODO: teardown flow
145
+ sp.on('exit', (code) => { Pear.exitCode = code })
147
146
 
148
147
  const pipe = sp.stdio[3]
148
+
149
149
  if (args.detach) return pipe
150
150
 
151
151
  const onerr = (data) => {