File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -46,18 +46,42 @@ export class SQLJob {
46
46
47
47
id : string | undefined ;
48
48
49
-
50
49
public static getNewUniqueId ( prefix : string = `id` ) : string {
51
50
return prefix + ( ++ SQLJob . uniqueIdCounter ) ;
52
51
}
53
52
53
+ public static async useExec ( ) {
54
+ let useExec = false ;
55
+
56
+ const instance = getInstance ( ) ;
57
+ const connection = instance . getConnection ( ) ;
58
+
59
+ const bashPathAvailable = connection . remoteFeatures [ `bash` ] ;
60
+ if ( bashPathAvailable ) {
61
+ const commandShellResult = await connection . sendCommand ( {
62
+ command : `echo $SHELL`
63
+ } ) ;
64
+ if ( ! commandShellResult . stderr ) {
65
+ let userDefaultShell = commandShellResult . stdout . trim ( ) ;
66
+ if ( userDefaultShell === bashPathAvailable ) {
67
+ useExec = true ;
68
+ }
69
+ }
70
+ }
71
+
72
+ return useExec ;
73
+ }
74
+
54
75
constructor ( public options : JDBCOptions = { } ) { }
55
76
private async getChannel ( ) {
56
77
const instance = getInstance ( ) ;
57
78
const connection = instance . getConnection ( ) ;
79
+
80
+ let useExec = await SQLJob . useExec ( ) ;
81
+
58
82
return new Promise ( ( resolve , reject ) => {
59
83
// Setting QIBM_JAVA_STDIO_CONVERT and QIBM_PASE_DESCRIPTOR_STDIO to make sure all PASE and Java converters are off
60
- const startingCommand = `QIBM_JAVA_STDIO_CONVERT=N QIBM_PASE_DESCRIPTOR_STDIO=B QIBM_USE_DESCRIPTOR_STDIO=Y QIBM_MULTI_THREADED=Y ` + ServerComponent . getInitCommand ( ) ;
84
+ const startingCommand = `QIBM_JAVA_STDIO_CONVERT=N QIBM_PASE_DESCRIPTOR_STDIO=B QIBM_USE_DESCRIPTOR_STDIO=Y QIBM_MULTI_THREADED=Y ${ useExec ? `exec ` : `` } ` + ServerComponent . getInitCommand ( ) ;
61
85
62
86
ServerComponent . writeOutput ( startingCommand ) ;
63
87
You can’t perform that action at this time.
0 commit comments