1
1
const fs = require ( 'fs' ) ;
2
+ const os = require ( 'os' ) ;
2
3
const child_process = require ( 'child_process' ) ;
3
4
4
5
let prog = '??' ;
@@ -42,7 +43,8 @@ function isPreRelease() {
42
43
}
43
44
44
45
function vsceRun ( pkgOnly ) {
45
- const args = [ 'npx' , 'vsce' , ( pkgOnly ? 'package' : 'publish' ) ] ;
46
+ const npx = 'npx' ;
47
+ const args = [ npx , 'vsce' , ( pkgOnly ? 'package' : 'publish' ) ] ;
46
48
if ( isPreRelease ( ) ) {
47
49
args . push ( '--pre-release' ) ;
48
50
if ( vsxAlso ) {
@@ -69,7 +71,7 @@ function vsceRun(pkgOnly) {
69
71
}
70
72
} ) ;
71
73
if ( vsxAlso ) {
72
- const vsxCmd = [ ' npx' , 'ovsx' , 'publish' , '-p' , openVsxPat ] ;
74
+ const vsxCmd = [ npx , 'ovsx' , 'publish' , '-p' , openVsxPat ] ;
73
75
runProg ( vsxCmd , ( code ) => {
74
76
if ( code !== 0 ) {
75
77
errExit ( `Failed '${ vsxCmd } '` ) ;
@@ -84,9 +86,12 @@ function runProg(args, cb) {
84
86
if ( isDryRun ) {
85
87
args . unshift ( 'echo' ) ;
86
88
}
87
- // console.log('Executing ' + args.join(' '));
88
89
const cmd = args . join ( ' ' ) ;
89
- const arg0 = args . shift ( ) ;
90
+ const arg0 = os . platform ( ) === 'win32' ? 'cmd.exe' : args . shift ( ) ;
91
+ if ( os . platform ( ) === 'win32' ) {
92
+ args . unshift ( '/c' ) ;
93
+ }
94
+ // console.log('Executing ' + arg0 + ' ' + args.join(' '));
90
95
const prog = child_process . spawn ( arg0 , args , {
91
96
stdio : 'inherit'
92
97
} ) ;
0 commit comments