I noticed that when nvptx-as spawns the ptxas process, the latter does still have the former's file descriptors open (in particular, the *.s input file), presumably due to missing 'close-on-exec' handling. I don't know if we can unconditionally use the e flag with fdopen, or manually have to set up FD_CLOEXEC etc.; see https://stackoverflow.com/questions/1643304/how-to-set-close-on-exec-by-default, for example.