MCPcopy Index your code
hub / github.com/cirosantilli/linux-kernel-module-cheat / write_string_to_file

Method write_string_to_file

shell_helpers.py:288–296  ·  view source on GitHub ↗
(self, path, string, mode='w')

Source from the content-addressed store, hash-verified

286 self.write_string_to_file(config_path, '\n'.join(configs), mode=mode)
287
288 def write_string_to_file(self, path, string, mode='w'):
289 if mode == 'a':
290 redirect = '>>'
291 else:
292 redirect = '>'
293 self.print_cmd("cat << 'EOF' {} {}\n{}\nEOF".format(redirect, path, string))
294 if not self.dry_run:
295 with open(path, mode) as f:
296 f.write(string)

Callers 1

write_configsMethod · 0.95

Calls 1

print_cmdMethod · 0.95

Tested by

no test coverage detected