noninteractive 0.3.7 → 0.3.9

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.
@@ -79,8 +79,10 @@ function getPtyBridge() {
79
79
  const platform = process.platform;
80
80
  const arch = process.arch;
81
81
  const binaryName = `ptybridge-${platform}-${arch}`;
82
+ const scriptDir = dirname(process.argv[1] || process.execPath);
82
83
  const candidates = [
83
- resolve3(dirname(process.argv[1] || process.execPath), "native", binaryName),
84
+ resolve3(scriptDir, "..", "native", binaryName),
85
+ resolve3(scriptDir, "native", binaryName),
84
86
  resolve3(dirname(import.meta.dirname), "native", binaryName),
85
87
  resolve3(import.meta.dirname, "..", "native", binaryName)
86
88
  ];
@@ -104,10 +106,11 @@ function runDaemon(sessionName, executable, args) {
104
106
  let exitCode = null;
105
107
  const waiters = [];
106
108
  function notifyWaiters() {
107
- while (waiters.length > 0) {
108
- const w = waiters.shift();
109
+ let w = waiters.shift();
110
+ while (w) {
109
111
  clearTimeout(w.timer);
110
112
  w.resolve(outputBuffer);
113
+ w = waiters.shift();
111
114
  }
112
115
  }
113
116
  const ptyBridge = getPtyBridge();
@@ -240,7 +243,7 @@ var init_daemon = __esm(() => {
240
243
  var require_package = __commonJS((exports, module) => {
241
244
  module.exports = {
242
245
  name: "noninteractive",
243
- version: "0.3.7",
246
+ version: "0.3.9",
244
247
  type: "module",
245
248
  bin: {
246
249
  noninteractive: "./bin/noninteractive.js"
@@ -360,8 +363,18 @@ more examples:
360
363
  npx noninteractive supabase init # session "supabase"
361
364
  npx noninteractive start vercel login # explicit start for non-npx commands`;
362
365
  function getSelfCommand() {
363
- if (process.argv[1] && /\.(ts|js)$/.test(process.argv[1])) {
364
- return [process.argv[0], process.argv[1]];
366
+ const script = process.argv[1];
367
+ if (!script)
368
+ return [process.argv[0]];
369
+ const { realpathSync } = __require("fs");
370
+ try {
371
+ const real = realpathSync(script);
372
+ if (/\.(ts|js)$/.test(real)) {
373
+ return [process.argv[0], real];
374
+ }
375
+ } catch {}
376
+ if (/\.(ts|js)$/.test(script)) {
377
+ return [process.argv[0], script];
365
378
  }
366
379
  return [process.argv[0]];
367
380
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noninteractive",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "noninteractive": "./bin/noninteractive.js"