AbstractOperatingSystem.st
changeset 17001 0524ca8f7a55
parent 16968 cde6c2e2e9be
child 17002 41fd1e27f184
equal deleted inserted replaced
17000:28e08401d7ae 17001:0524ca8f7a55
  1214 	inDirectory:aDirectory
  1214 	inDirectory:aDirectory
  1215 	lineWise:false
  1215 	lineWise:false
  1216 	onError:aBlock
  1216 	onError:aBlock
  1217 
  1217 
  1218     "Modified: / 10.11.1998 / 20:54:37 / cg"
  1218     "Modified: / 10.11.1998 / 20:54:37 / cg"
       
  1219 !
       
  1220 
       
  1221 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream errorTo:anErrStream
       
  1222     "execute the unix command specified by the argument, aCommandString.
       
  1223      The commandString is passed to a shell for execution - see the description of
       
  1224      'sh -c' in your UNIX manual.
       
  1225      Return true if successful, false if not."
       
  1226 
       
  1227     ^ self
       
  1228         executeCommand:aCommandString
       
  1229         inputFrom:anInStream
       
  1230         outputTo:anOutStream
       
  1231         errorTo:anErrStream
       
  1232         auxFrom:nil
       
  1233         environment:nil
       
  1234         inDirectory:nil
       
  1235         lineWise:false
       
  1236         onError:[:status | false]
       
  1237 
       
  1238     "
       
  1239         OperatingSystem
       
  1240             executeCommand:'ls'
       
  1241             inputFrom:nil
       
  1242             outputTo:Transcript
       
  1243             errorTo:Transcript        
       
  1244 
       
  1245         |s|
       
  1246         s := WriteStream on:''.
       
  1247         (OperatingSystem
       
  1248             executeCommand:'ls'
       
  1249             inputFrom:nil
       
  1250             outputTo:s
       
  1251             errorTo:Transcript) ifTrue:[Transcript showCR:s contents]        
       
  1252 
       
  1253         OperatingSystem
       
  1254             executeCommand:'dir'
       
  1255             inputFrom:nil
       
  1256             outputTo:Transcript
       
  1257             errorTo:Transcript
       
  1258 
       
  1259         OperatingSystem
       
  1260             executeCommand:'foo'
       
  1261             inputFrom:Transcript
       
  1262             outputTo:Transcript
       
  1263             errorTo:nil
       
  1264     "
       
  1265     "
       
  1266         |outStr errStr|
       
  1267 
       
  1268         outStr := '' writeStream.
       
  1269         errStr := '' writeStream.
       
  1270         OperatingSystem
       
  1271             executeCommand:'ls'
       
  1272             inputFrom:nil
       
  1273             outputTo:outStr
       
  1274             errorTo:errStr
       
  1275             onError:[:status | Transcript flash].
       
  1276         Transcript show:'out:'; showCR:outStr contents.
       
  1277         Transcript show:'err:'; showCR:errStr contents.
       
  1278     "
       
  1279     "
       
  1280         |outStr errStr|
       
  1281 
       
  1282         outStr := '' writeStream.
       
  1283         errStr := '' writeStream.
       
  1284         OperatingSystem
       
  1285             executeCommand:'ls /fooBar'
       
  1286             inputFrom:nil
       
  1287             outputTo:outStr
       
  1288             errorTo:errStr
       
  1289             onError:[:status | Transcript flash].
       
  1290         Transcript show:'out:'; showCR:outStr contents.
       
  1291         Transcript show:'err:'; showCR:errStr contents.
       
  1292     "
       
  1293 
       
  1294     "Modified: / 10.11.1998 / 20:51:39 / cg"
  1219 !
  1295 !
  1220 
  1296 
  1221 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream
  1297 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream
  1222     errorTo:anErrStream auxFrom:anAuxStream environment:environmentDictionary
  1298     errorTo:anErrStream auxFrom:anAuxStream environment:environmentDictionary
  1223     inDirectory:dirOrNil lineWise:lineWise onError:aBlock
  1299     inDirectory:dirOrNil lineWise:lineWise onError:aBlock
  7521 ! !
  7597 ! !
  7522 
  7598 
  7523 !AbstractOperatingSystem class methodsFor:'documentation'!
  7599 !AbstractOperatingSystem class methodsFor:'documentation'!
  7524 
  7600 
  7525 version
  7601 version
  7526     ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.272 2014-11-07 17:49:34 cg Exp $'
  7602     ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.273 2014-11-08 10:16:32 cg Exp $'
  7527 !
  7603 !
  7528 
  7604 
  7529 version_CVS
  7605 version_CVS
  7530     ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.272 2014-11-07 17:49:34 cg Exp $'
  7606     ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.273 2014-11-08 10:16:32 cg Exp $'
  7531 ! !
  7607 ! !
  7532 
  7608 
  7533 
  7609 
  7534 AbstractOperatingSystem initialize!
  7610 AbstractOperatingSystem initialize!