in reply to Problem with 'system' function in Windows Vista
Your snippet makes no sense (although none of this explains the crash).
- system(1, ...) does not return zero on success.
- system(1, ...) does not return the exit code of the child. It returns the PID of the child.
- $? is being checked before the child has finished running, so its value is meaningless.
Did you really mean to execute the child asynchronously? You're acting as if you want the child to end before proceeding. If so, you want system(@cmd), not system(1, @cmd).