diff options
| author | Igor Pashev <pashev.igor@gmail.com> | 2012-04-28 19:08:13 +0400 |
|---|---|---|
| committer | Igor Pashev <pashev.igor@gmail.com> | 2012-04-28 19:08:13 +0400 |
| commit | d40220c1df37d5b981250880dc3043c38bca53d0 (patch) | |
| tree | 0eb81f3dc1fdbd87e7f82b166de6d77247fa2d07 /examples | |
| parent | 08bd9c3007c69b3c88d2b11dbba904394d9b680f (diff) | |
| download | node-augeas-d40220c1df37d5b981250880dc3043c38bca53d0.tar.gz | |
Async save passes the return value of aug_save(): 0 on success, -1 on failure
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/async-write-etc-hosts.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/async-write-etc-hosts.js b/examples/async-write-etc-hosts.js index 70640ab..41ad38c 100644 --- a/examples/async-write-etc-hosts.js +++ b/examples/async-write-etc-hosts.js @@ -5,14 +5,14 @@ var aug = require('../build/Release/libaugeas'); // but for the goodness sake we set AUG_SAVE_NEWFILE flag here, // so your /etc/hosts will be kept untouched :-) aug.createAugeas( - {lens: 'hosts', incl: '/etc/hosts', flags:aug.AUG_SAVE_NEWFILE}, + {lens: 'hosts', incl: '/etc/hosts', flags: aug.AUG_SAVE_NEWFILE}, function(aug) { if (!aug.error()) { console.log('Making changes ...'); aug.set('/files/etc/hosts/1/ipaddr', '127.0.0.2'); aug.set('/files/etc/hosts/1/canonical', 'localhost'); - aug.save(function(success) { - if (success) { + aug.save(function(err) { + if (!err) { console.log('Saved! Take a look at /etc/hosts.augnew'); } else { console.log('Failed :-( Here is the reason:'); |
