termux-tts 1.4.2 → 1.4.3

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.
package/bin/cli.js CHANGED
@@ -1,33 +1,33 @@
1
- #!/usr/bin/env node
2
- /**
3
- * termux-tts Node.js Global CLI Wrapper
4
- * Cross-platform entry point for npm global execution.
5
- */
6
- const { spawn } = require('child_process');
7
- const path = require('path');
8
-
9
- const args = process.argv.slice(2);
10
- const pyBin = process.env.PYTHON_BIN || (process.platform === 'win32' ? 'py' : 'python3');
11
-
12
- // 1. Try running module entry point directly
13
- const pyProcess = spawn(pyBin, ['-m', 'termux_tts.cli', ...args], {
14
- stdio: 'inherit',
15
- env: { ...process.env, PYTHONPATH: path.join(__dirname, '..') }
16
- });
17
-
18
- pyProcess.on('error', (err) => {
19
- // 2. Fallback to standalone binary
20
- const binProcess = spawn('termux-tts', args, { stdio: 'inherit' });
21
- binProcess.on('error', (bErr) => {
22
- console.error('[ERROR] Failed to execute termux-tts CLI:', bErr.message);
23
- process.exit(1);
24
- });
25
- binProcess.on('close', (code) => {
26
- process.exit(code || 0);
27
- });
28
- });
29
-
30
- pyProcess.on('close', (code) => {
31
- process.exit(code || 0);
32
- });
33
-
1
+ #!/usr/bin/env node
2
+ /**
3
+ * termux-tts Node.js Global CLI Wrapper
4
+ * Cross-platform entry point for npm global execution.
5
+ */
6
+ const { spawn } = require('child_process');
7
+ const path = require('path');
8
+
9
+ const args = process.argv.slice(2);
10
+ const pyBin = process.env.PYTHON_BIN || (process.platform === 'win32' ? 'py' : 'python3');
11
+
12
+ // 1. Try running module entry point directly
13
+ const pyProcess = spawn(pyBin, ['-m', 'termux_tts.cli', ...args], {
14
+ stdio: 'inherit',
15
+ env: { ...process.env, PYTHONPATH: path.join(__dirname, '..') }
16
+ });
17
+
18
+ pyProcess.on('error', (err) => {
19
+ // 2. Fallback to standalone binary
20
+ const binProcess = spawn('termux-tts', args, { stdio: 'inherit' });
21
+ binProcess.on('error', (bErr) => {
22
+ console.error('[ERROR] Failed to execute termux-tts CLI:', bErr.message);
23
+ process.exit(1);
24
+ });
25
+ binProcess.on('close', (code) => {
26
+ process.exit(code || 0);
27
+ });
28
+ });
29
+
30
+ pyProcess.on('close', (code) => {
31
+ process.exit(code || 0);
32
+ });
33
+