Skip to content

Commit 33a5680

Browse files
committed
feat: Adding error when enable to open with default browser
1 parent 990557a commit 33a5680

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

templates/cli/lib/utils.js.twig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fs = require("fs");
22
const path = require("path");
33
const { localConfig, globalConfig } = require("./config");
4-
const { success, log } = require('./parser')
4+
const { success, log, error } = require('./parser')
55
const readline = require('readline');
66
const cp = require('child_process');
77

@@ -67,7 +67,13 @@ function showConsoleLink(serviceName, action, open, ...ids) {
6767

6868
if (open) {
6969
const start = (process.platform == 'darwin' ? 'open' : process.platform == 'win32' ? 'start' : 'xdg-open');
70-
cp.exec(`${start} ${url}`);
70+
71+
cp.exec(`${start} ${url}`, (err, stdout, stderr) => {
72+
if (err !== null) {
73+
console.log('\n');
74+
error('Opening in default browser. ' + err)
75+
}
76+
});
7177
}
7278
}
7379

0 commit comments

Comments
 (0)