!2 Fix check failure
From: @lei_ju Reviewed-by: @solarhu Signed-off-by: @solarhu
This commit is contained in:
commit
8def384a54
64
0001-Fix-Buffer-warnings-by-switching-to-Buffer.from.patch
Normal file
64
0001-Fix-Buffer-warnings-by-switching-to-Buffer.from.patch
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
From 6be9fdb20b77842151aa52d49e9dab183345b4b1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: lei_ju <lj3074194431@163.com>
|
||||||
|
Date: Thu, 3 Dec 2020 15:34:48 +0800
|
||||||
|
Subject: [PATCH] Fix Buffer warnings by switching to Buffer.from
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/index.js b/index.js
|
||||||
|
index a61d9cc..7f389e6 100644
|
||||||
|
--- a/index.js
|
||||||
|
+++ b/index.js
|
||||||
|
@@ -182,16 +182,16 @@ util.spawn = function(opts, done) {
|
||||||
|
}
|
||||||
|
|
||||||
|
var child = spawn(cmd, args, opts.opts);
|
||||||
|
- var stdout = new Buffer('');
|
||||||
|
- var stderr = new Buffer('');
|
||||||
|
+ var stdout = Buffer.from('');
|
||||||
|
+ var stderr = Buffer.from('');
|
||||||
|
if (child.stdout) {
|
||||||
|
child.stdout.on('data', function(buf) {
|
||||||
|
- stdout = Buffer.concat([stdout, new Buffer(buf)]);
|
||||||
|
+ stdout = Buffer.concat([stdout, Buffer.from(buf)]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (child.stderr) {
|
||||||
|
child.stderr.on('data', function(buf) {
|
||||||
|
- stderr = Buffer.concat([stderr, new Buffer(buf)]);
|
||||||
|
+ stderr = Buffer.concat([stderr, Buffer.from(buf)]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
child.on('close', function(code) {
|
||||||
|
diff --git a/test/fixtures/spawn-multibyte.js b/test/fixtures/spawn-multibyte.js
|
||||||
|
index 8277711..b592341 100644
|
||||||
|
--- a/test/fixtures/spawn-multibyte.js
|
||||||
|
+++ b/test/fixtures/spawn-multibyte.js
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
// A multibyte buffer containing all our output. We will slice it later.
|
||||||
|
// In this case we are using a Japanese word for hello / good day, where each
|
||||||
|
// character takes three bytes.
|
||||||
|
-var fullOutput = new Buffer('こんにちは');
|
||||||
|
+var fullOutput = Buffer.from('こんにちは');
|
||||||
|
|
||||||
|
// Output one full character and one third of a character
|
||||||
|
process.stdout.write(fullOutput.slice(0, 4));
|
||||||
|
diff --git a/test/index.js b/test/index.js
|
||||||
|
index 4a657be..55cf79f 100644
|
||||||
|
--- a/test/index.js
|
||||||
|
+++ b/test/index.js
|
||||||
|
@@ -477,10 +477,10 @@ exports['util.recurse'] = {
|
||||||
|
'buffer': function(test) {
|
||||||
|
test.expect(1);
|
||||||
|
var actual = util.recurse({
|
||||||
|
- buf: new Buffer('buf'),
|
||||||
|
+ buf: Buffer.from('buf'),
|
||||||
|
}, this.typeValue);
|
||||||
|
var expected = {
|
||||||
|
- buf: {type: 'buffer', value: new Buffer('buf')},
|
||||||
|
+ buf: {type: 'buffer', value: Buffer.from('buf')},
|
||||||
|
};
|
||||||
|
test.deepEqual(actual, expected, 'Should not mangle Buffer instances.');
|
||||||
|
test.done();
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
@ -1,12 +1,13 @@
|
|||||||
%global enable_tests 1
|
%global enable_tests 1
|
||||||
Name: nodejs-grunt-legacy-util
|
Name: nodejs-grunt-legacy-util
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Deprecated Grunt utils provided for backwards compatibility
|
Summary: Deprecated Grunt utils provided for backwards compatibility
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/gruntjs/grunt-legacy-util
|
URL: https://github.com/gruntjs/grunt-legacy-util
|
||||||
Source0: https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-%{version}.tgz
|
Source0: https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-%{version}.tgz
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
Patch0: 0001-Fix-Buffer-warnings-by-switching-to-Buffer.from.patch
|
||||||
ExclusiveArch: %{nodejs_arches} noarch
|
ExclusiveArch: %{nodejs_arches} noarch
|
||||||
BuildRequires: nodejs-packaging
|
BuildRequires: nodejs-packaging
|
||||||
%if 0%{?enable_tests}
|
%if 0%{?enable_tests}
|
||||||
@ -19,6 +20,7 @@ BuildRequires: npm(async) npm(hooker)
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n package
|
%setup -q -n package
|
||||||
|
%patch0 -p1
|
||||||
%nodejs_fixdep async '^1.5.0'
|
%nodejs_fixdep async '^1.5.0'
|
||||||
%nodejs_fixdep lodash '^3.10.1'
|
%nodejs_fixdep lodash '^3.10.1'
|
||||||
%nodejs_fixdep underscore.string '~2.3.1'
|
%nodejs_fixdep underscore.string '~2.3.1'
|
||||||
@ -47,5 +49,8 @@ cp -pr package.json index.js \
|
|||||||
%{nodejs_sitelib}/grunt-legacy-util
|
%{nodejs_sitelib}/grunt-legacy-util
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 18 2020 leiju <leiju4@huawei.com> - 1.0.0-2
|
||||||
|
- Fix check failure
|
||||||
|
|
||||||
* Thu Aug 20 2020 Anan Fu <fuanan3@huawei.com> - 1.0.0-1
|
* Thu Aug 20 2020 Anan Fu <fuanan3@huawei.com> - 1.0.0-1
|
||||||
- package init
|
- package init
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user