File tree Expand file tree Collapse file tree 4 files changed +20
-5
lines changed
Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ declare global {
3535 var path : typeof _ . path
3636 var question : typeof _ . question
3737 var quiet : typeof _ . quiet
38+ var quote : typeof _ . quote
39+ var quotePowerShell : typeof _ . quotePowerShell
3840 var sleep : typeof _ . sleep
3941 var stdin : typeof _ . stdin
4042 var which : typeof _ . which
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export {
4343 YAML ,
4444} from './goods.js'
4545
46- export { Duration } from './util.js'
46+ export { Duration , quote , quotePowerShell } from './util.js'
4747
4848/**
4949 * @deprecated Use $.nothrow() instead.
Original file line number Diff line number Diff line change @@ -23,3 +23,6 @@ expectType<ProcessPromise>(p)
2323let o = await p
2424assert ( o instanceof ProcessOutput )
2525expectType < ProcessOutput > ( o )
26+
27+ expectType < string > ( quote ( 'foo' ) )
28+ expectType < string > ( quotePowerShell ( 'foo' ) )
Original file line number Diff line number Diff line change @@ -22,13 +22,23 @@ $.verbose = false
2222
2323if ( process . platform === 'win32' ) {
2424 test ( 'should work with windows-specific commands' , async ( ) => {
25- const p = await $ `get-host`
26- assert . match ( p . stdout , / P o w e r S h e l l / )
25+ const p = await $ `echo $0` // Bash is first by default.
26+ assert . match ( p . stdout , / b a s h / )
27+ await within ( async ( ) => {
28+ $ . shell = which . sync ( 'powershell.exe' )
29+ $ . quote = quotePowerShell
30+ const p = await $ `get-host`
31+ assert . match ( p . stdout , / P o w e r S h e l l / )
32+ } )
2733 } )
2834
2935 test ( 'quotePowerShell works' , async ( ) => {
30- const p = await $ `echo ${ `Windows 'rulez!'` } `
31- assert . match ( p . stdout , / W i n d o w s ' r u l e z ! ' / )
36+ await within ( async ( ) => {
37+ $ . shell = which . sync ( 'powershell.exe' )
38+ $ . quote = quotePowerShell
39+ const p = await $ `echo ${ `Windows 'rulez!'` } `
40+ assert . match ( p . stdout , / W i n d o w s ' r u l e z ! ' / )
41+ } )
3242 } )
3343}
3444
You can’t perform that action at this time.
0 commit comments