diff --git a/stdlib/system/src/main/java/org/ballerinalang/stdlib/system/nativeimpl/Exec.java b/stdlib/system/src/main/java/org/ballerinalang/stdlib/system/nativeimpl/Exec.java index 63e9c28015ee..0403b8bf9384 100644 --- a/stdlib/system/src/main/java/org/ballerinalang/stdlib/system/nativeimpl/Exec.java +++ b/stdlib/system/src/main/java/org/ballerinalang/stdlib/system/nativeimpl/Exec.java @@ -42,9 +42,11 @@ public class Exec { private static final Logger log = LoggerFactory.getLogger(Exec.class); public static Object exec(String command, MapValue env, Object dir, ArrayValue args) { - List commandList = new ArrayList(); - commandList.add(command); - commandList.addAll(Arrays.asList(args.getStringArray())); + String space = " "; + List commandList = new ArrayList(Arrays.asList(command.split(space))); + for (String arg : args.getStringArray()) { + commandList.addAll(Arrays.asList(arg.split(space))); + } ProcessBuilder pb = new ProcessBuilder(commandList); if (dir != null) { pb.directory(new File((String) dir));