netdigger
netdigger

Reputation: 3789

SCons removes space from Action/Command

With the following command:

env.Command('XYZ', 'somefile', 'echo "Hello,    how are   you" > $TARGET')

SCons squashes the space and runs:

echo "Hello, how are you" > XYZ

And:

$ cat XYZ
Hello, how are you

Why is this and can I stop it?

Upvotes: 0

Views: 57

Answers (1)

dirkbaechle
dirkbaechle

Reputation: 4052

This is a known problem, documented in the bugs #1123 and #2018.

In your case where you simply want to create a text file, there is a simple workaround which has the additional benefit of working cross-platform: using the Textfile Builder...

env = Environment(tools=['default', 'textfile'])

env.Textfile('XYZ','Hello,    how are   you')

This will create the target file with a *.txt extension, because that's the default of the Builder. If you don't like it, you can overwrite the variable $TEXTFILESUFFIX. Either globally in the Environment, or locally for a single Builder call like:

env.Textfile('XYZ','Hello,    how are   you', TEXTFILESUFFIX='')

Upvotes: 1

Related Questions