Skip to content

Respecting Quotes in Custom Generator Command #3

Description

@GCHQDeveloper560

I'm experimenting with Chisel and FuseSoC. Using the Chisel template Verilog can be generated with a command like

sbt 'runMain gcd.GCD'

Note that it appears sbt wants all of its arguments as a single string.

Rather than jumping into a special sbt or Chisel generator I attempted to use the custom generator to run the above command. The list passed to the subprocess call should be ['sbt', 'runMain gcd.GCD']. However, the string split command used in the custom generator doesn't respect quotes and produces ['sbt', "'runMain", "gcd.GCD'"]. It appears that shlex.split handles quotes as I would expect

>>> cmd="sbt 'runMain gcd.GCD'"
>>> cmd.split()
['sbt', "'runMain", "gcd.GCD'"]
>>> import shlex
>>> shlex.split(cmd)
['sbt', 'runMain gcd.GCD']

II've not found a way of escaping quotes or the like that will work with the string split method, but am certainly open to suggestions. Would it make sense to change the split command used in the custom generator, or is this likely to cause too many compatibility issues?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions